﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class NewsDetail : System.Web.UI.Page
{
    public string url = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {

            
            int lang = 2;
            if (Request.QueryString["lang"] != "" && Request.QueryString["lang"] != null) lang = Convert.ToInt32(Request.QueryString["lang"]);

            TinTucDataSet gtDs = new TinTucHelper().LoadTinTuc(Convert.ToInt32(Request["id"]));
            rptDetail.DataSource = gtDs;
            rptDetail.DataBind();
            int loai = Convert.ToInt32(gtDs.TinTuc[0].Loai);
            if (gtDs.TinTuc.Rows.Count > 0)
            {
                TinTucDataSet gtDst = new TinTucHelper().LoadTinTuc(1,10,"NgayDang","desc",Convert.ToInt32(gtDs.TinTuc[0].Loai), Convert.ToInt32(gtDs.TinTuc[0].Lang));
                rptTinCungTheLoai.DataSource = gtDst;
                rptTinCungTheLoai.DataBind();
            }
            if (lang == 1)
            {
                url = "<a href='/TinTuc.aspx?lang=1' >Tin tức </a> >> ";
            }
            else
            {
                url = "<a href='/TinTuc.aspx?lang=2' >Hot news </a> >> ";
            }
            lbpageName.Text = url + "<a href='News.aspx?loai=" + loai + "&lang=" + lang + "' >" + LoaiDataHelper.LoadLoaiTinTuc(lang)[loai].ToString() + "</a> >> " + gtDs.TinTuc[0].Ten;
        }
    }
}
